<!--Copyright (C) Kherty.  All rights reserved.-->
<UserControl x:Class="OpenLS.Spreadsheet.UI.NameManagerControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
    xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals"
    xmlns:Spreadsheet="clr-namespace:OpenLS.Spreadsheet;assembly=OpenLS.Spreadsheet"
             xmlns:Resources="clr-namespace:OpenLS.Spreadsheet.UI.Internals.Resources">
    <Border BorderBrush="Black" BorderThickness="1" Background="Beige" CornerRadius="18"  Padding="10">
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
        <Grid.Resources>
            <DataTemplate DataType="{x:Type Spreadsheet:Range}">
                <TextBlock Text="{Binding FullLabel}"></TextBlock>
            </DataTemplate>

            <DataTemplate DataType="{x:Type Spreadsheet:SingleCellRange}">
                <TextBlock Text="{Binding FullLabel}"></TextBlock>
            </DataTemplate>

        </Grid.Resources>
            <DockPanel>
      <Button DockPanel.Dock="Left" Click="OnNew" Content="{x:Static Resources:UIStringTable.New__}" ></Button>
      <Button  DockPanel.Dock="Left" Click="OnEdit" Content="{x:Static Resources:UIStringTable.Edit__}"></Button>
      <Button  DockPanel.Dock="Left" Click="OnDelete" Content="{x:Static Resources:UIStringTable.Delete}"></Button>
      <Button  DockPanel.Dock="Right" HorizontalAlignment="Right" Content="{x:Static Resources:UIStringTable.Filter}" ></Button>
    </DockPanel>
    <ListView Grid.Row="1" MinHeight="200" ItemsSource ="{Binding Path=Workbook.DefinedNames}" Name="lv">
      <ListView.View>
        <GridView>
          <GridViewColumn Header ="{x:Static Resources:UIStringTable.Name}" DisplayMemberBinding="{Binding Name}"/>
          <GridViewColumn Header ="{x:Static Resources:UIStringTable.Formula}" DisplayMemberBinding="{Binding Formula}"/>
                    <GridViewColumn Header ="{x:Static Resources:UIStringTable.RefersTo}" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <ContentControl Content="{Binding Value, Mode=OneWay}"></ContentControl>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                        <GridViewColumn Header ="{x:Static Resources:UIStringTable.Scope}" DisplayMemberBinding="{Binding Scope}"/>
          <GridViewColumn Header ="{x:Static Resources:UIStringTable.Comment}" DisplayMemberBinding="{Binding Comment}">
          </GridViewColumn>
        </GridView>
      </ListView.View>
    </ListView>
    <Button Grid.Row="3" HorizontalAlignment="Right" 
            IsCancel ="True"
            Content="{Binding Source={x:Static ApplicationCommands.Close}, Path=Text}" ></Button>
  </Grid>
    </Border>
</UserControl>
